import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:xvideos/assets_tool/app_colors.dart';
import 'package:xvideos/hj_utils/widget_utils.dart';

import 'invite_bind_logic.dart';

class InviteBindPage extends StatelessWidget {
  const InviteBindPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<InviteBindLogic>(
      init: InviteBindLogic(),
      builder: (controller) => Scaffold(
        appBar: AppBar(
          title: Text('绑定邀请码'),
        ),
        body: Padding(
          padding: EdgeInsets.only(left: 28, right: 28, top: 28),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '输入邀请码',
                style: TextStyle(color: Colors.white.withOpacity(0.9), fontSize: 30, fontWeight: FontWeight.w500),
              ),
              12.verticalSpace,
              Text(
                '邀请码只能绑定一次 且不能修改',
                style: TextStyle(
                  color: Colors.white.withOpacity(0.35),
                  fontSize: 16,
                  fontWeight: FontWeight.w400,
                ),
              ),
              30.verticalSpace,
              Container(
                width: double.infinity,
                height: 42,
                child: Row(
                  children: [
                    Text(
                      '邀请码',
                      style: TextStyle(color: Colors.white.withOpacity(0.9), fontSize: 16),
                    ),
                    24.sizeBoxW,
                    Expanded(
                      child: TextField(
                        controller: controller.codeCtr,
                        style: TextStyle(
                          color: Colors.white.withOpacity(0.9),
                          fontSize: 14,
                        ),
                        maxLength: 11,
                        decoration: InputDecoration(
                            border: InputBorder.none,
                            hintText: '请输入邀请码（字母大写）',
                            isCollapsed: true,
                            contentPadding: EdgeInsets.zero,
                            counterText: '',
                            hintStyle: TextStyle(color: Colors.white.withOpacity(0.35), fontSize: 14)),
                      ),
                    )
                  ],
                ),
              ),
              10.sizeBoxH,
              Divider(
                height: .35,
                color: Colors.white.withOpacity(.05),
              ),
              18.sizeBoxH,
              Text(
                '邀请1人 获得1天会员',
                style: TextStyle(color: Colors.white.withOpacity(0.35), fontSize: 14),
              ),
              30.sizeBoxH,
              GestureDetector(
                onTap: () => controller.sure(),
                child: Container(
                  width: double.infinity,
                  height: 44,
                  alignment: Alignment.center,
                  child: Text(
                    '立即绑定',
                    style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w500),
                  ),
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(3),
                    color: AppColors.actionRed,
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
